package com.itheima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.health.pojo.Menu;
import com.itheima.health.vo.MenuVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MenuMapper extends BaseMapper<Menu> {

//    @Select("select role_id " +
//            "from t_role_menu " +
//            "where menu_id =#{id}")
//    int[] findPermissionIdsbyRoleId(int id);

//        @Insert("insert into t_role_menu values(#{roleId} , #{mid})")
//    void addRoleAndMenuId( @Param("roleId") Integer roleId,@Param("mid") Integer mid);

    @Delete("delete from t_role_menu where role_id=#{id}")
    void deleteRoleInfoByMenuId(Integer id);

    @Select("select * from t_role")
    List<MenuVO> findAll();


    @Select("select * from t_menu")
    List<Menu>  findAllMenu();

    @Select("select path,name,linkUrl,icon from t_menu where id=#{id}")
    List<MenuVO> getMenuList(@Param("id") Integer id);
}
